/*
 * Instance.h
 *
 *  Created on: May 26, 2012
 *      Author: hugo
 */

#ifndef INSTANCE_H_
#define INSTANCE_H_
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<fstream>
#include "Vertex.h"
#include "Edge.h"

using namespace std;

class Instance {
public:
	Instance(string arq_name);
	virtual ~Instance();
	void remove_edge(int,int);
	void remove_edge(int);
	Edge* get_edge(int,int);
	Edge* get_edge(int);
	int compare_edges(Edge*,Edge*);
	Vertex* get_vertex(int);
	vector<int> neighborhood(int);
	float avg_degree(int);
	float avg_degree(Vertex*);
	long num_vertex();
	long num_edge();
	void short_path_prize_test();
	int short_path_cost_test();
	float get_total_prize();
	void pre_test();
	int card_one_test();
	int card_two_test();
	void calculate_short_path_prize();
	float get_path_cost(int,int);
	float get_path_prize(int,int);
	bool has_vertex_at_path(int i,int j, int k);
	Vertex* get_vertex_sorted_by_prize(int);
	Edge* get_edge_sorted_by_cost(int);
	int get_golden_node();
private:
    int ***path_v;
    int golden_node;
    float **path_cost;
    float **path_prize;
    int **path_next;
	Edge*** matriz;
	string arq_name;
	long total_vertex;
	long total_edge;
	float total_prize;
	vector<Vertex*> vertexs;
	vector<Vertex*> vertexs_prize;
	vector<Edge*> edges;
	vector<Edge*> edges_sorted;
	vector<vector<int> > neighbors;
	void loadFile();
	void calculate_short_path_cost();
	void init_short_path();
	void init_short_path_prize();
	int short_path_test();
	void short_path_test_prize();
	void print_path(int i,int j);
	void set_values();
};

#endif /* INSTANCE_H_ */
